package com.whisperly.echotalk.starryb.utils;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.whisperly.echotalk.starryb.R;

import java.net.URISyntaxException;
import java.util.Objects;


public class Mutual extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mutual);
        AppsManager.addActivity(this);
        TextView viewById = findViewById(R.id.toolbar_title);
        if (getIntent().hasExtra("str2")){
            viewById.setText(getIntent().getStringExtra("str2"));
        }


        WebView webView = (WebView) findViewById(R.id.myWebview);
        webView.setWebChromeClient(new WebChromeClient());

        webView.removeJavascriptInterface("searchBoxJavaBridge_");
        webView.removeJavascriptInterface("accessibility");
        webView.removeJavascriptInterface("accessibilityTraversal");

        if (getIntent().hasExtra("str1")){
            String str11 = getIntent().getStringExtra("str1");
            if (str11 != null){
                webView.loadUrl(str11);
            }
        }


    }

    @Override
    public void onBackPressed() {
        WebView webView = (WebView) findViewById(R.id.myWebview);
        if (webView.canGoBack()) {
            webView.goBack();
        } else {
            super.onBackPressed();
        }
    }

}